package boot

import (
	"yunj/config"
	"yunj/pkg/global"
	yunjConfig "yunj/pkg/yunj/config"
)

// 初始化主题配置
func InitThemeConfig() {
	themeConfig := append(yunjConfig.Theme, config.Theme...)
	for i, v := range themeConfig {
		if tplStyleFile, exists := v["tpl_style_file"]; exists {
			if tplStyleFileStr, ok := tplStyleFile.(string); ok {
				themeConfig[i]["tpl_style_file"] = tplStyleFileStr + "?v=" + config.VERSION
			}
		}
		if styleFile, exists := v["style_file"]; exists {
			if styleFileStr, ok := styleFile.(string); ok {
				themeConfig[i]["style_file"] = styleFileStr + "?v=" + config.VERSION
			}
		}
	}
	global.ThemeConfig = themeConfig
}
